package flater.cairngormtips.controller.commands
{

import com.adobe.cairngorm.control.CairngormEvent;
import com.universalmind.cairngorm.commands.Command;
import com.universalmind.cairngorm.events.AnnounceFaultEvent;

import mx.controls.Alert;
import mx.rpc.Fault;

/**
 *  A generic fault handler for faults dispatched via the <code>AnnounceFaultEvent</code><br/>
 *  <br/>                                                                                            
 *  Author: <a href="http://www.adamflater.net" target="_blank">Adam Flater</a>
 *  <br/>                                                                                          
 */
public class FaultCommand extends Command
{
	public function FaultCommand()
	{
		super();
	}
	
	override public function execute( event : CairngormEvent ) : void
	{
	    //--------------------------------------
	    //  The FaultEvent in our example ends
	    //  here.. all thanks to the UM
	    //  AnnounceFaultEvent
	    //--------------------------------------
	    
	    var fault : Fault = ( event as AnnounceFaultEvent ).fault;
	    
	    Alert.show( fault.faultString, fault.faultCode );
	}
	

} //  end class
} //  end package